package com.yzjs.localhost.controller.tDataPersistenceAfter;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

import com.yzjs.common.enumeration.RequestMethod;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import com.yzjs.common.base.entity.PageInfo;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.yzjs.localhost.entity.tDataPersistenceAfter.TDataPersistenceAfterEntity;
import com.yzjs.localhost.service.tDataPersistenceAfter.TDataPersistenceAfterService;




/**
 * 入库之后参数存储
 *
 * @author yuqiumin
 * @email sunlightcs@gmail.com
 * @date 2021-08-24 17:00:37
 */
@Api(tags = "入库之后参数存储")
@RestController
@RequestMapping("tDataPersistenceAfter")
public class TDataPersistenceAfterController {
    @Autowired
    private TDataPersistenceAfterService tDataPersistenceAfterService;




    /**
     * 信息
     */
    @ApiOperation(value="信息" ,httpMethod =RequestMethod.GET )
    @RequestMapping("/info")
    public TDataPersistenceAfterEntity info( @RequestParam(required = true)   Integer id){
        TDataPersistenceAfterEntity  query = new TDataPersistenceAfterEntity();
        query.setId(id);
        TDataPersistenceAfterEntity tDataPersistenceAfter = tDataPersistenceAfterService.findOne(query);
        return  tDataPersistenceAfter ;
    }
    /**
    * 列表查询
    * @return
    */
    @ApiOperation(value="列表查询" ,httpMethod =RequestMethod.POST )
    @RequestMapping("/list")
    public List<TDataPersistenceAfterEntity> List( @RequestBody TDataPersistenceAfterEntity tDataPersistenceAfter) {

        List<TDataPersistenceAfterEntity> tDataPersistenceAfters = tDataPersistenceAfterService.findList(tDataPersistenceAfter);
        return tDataPersistenceAfters;
    }


    /**
     * 分页查询
     * @param tDataPersistenceAfter
     * @return
     */
    @ApiOperation(value="分页查询" ,httpMethod =RequestMethod.POST )
    @RequestMapping("/listPage")
    public PageInfo<TDataPersistenceAfterEntity> listPage(@RequestBody TDataPersistenceAfterEntity tDataPersistenceAfter) {
        List<TDataPersistenceAfterEntity> tDataPersistenceAfters  = tDataPersistenceAfterService.findList(tDataPersistenceAfter);
        return new PageInfo<>(tDataPersistenceAfters ,tDataPersistenceAfter);
    }


    /**
     * 保存
     */
    @ApiOperation(value="保存" ,httpMethod =RequestMethod.POST )
    @RequestMapping("/save")
    public TDataPersistenceAfterEntity save(@RequestBody TDataPersistenceAfterEntity tDataPersistenceAfter){
		tDataPersistenceAfterService.insert(tDataPersistenceAfter);
        return tDataPersistenceAfter;
    }

    /**
     * 修改
     */
    @ApiOperation(value="修改" ,httpMethod =RequestMethod.POST )
    @RequestMapping("/update")
    public TDataPersistenceAfterEntity update(@RequestBody TDataPersistenceAfterEntity tDataPersistenceAfter){
		tDataPersistenceAfterService.update(tDataPersistenceAfter);
        return tDataPersistenceAfter;
    }

    /**
     * 删除
     */
    @ApiOperation(value="删除" ,httpMethod =RequestMethod.DELETE )
    @RequestMapping("/delete")
    public TDataPersistenceAfterEntity  delete( @RequestParam(required = true)  Integer id){
        TDataPersistenceAfterEntity  delete  = new TDataPersistenceAfterEntity();
        delete.setId(id);
        tDataPersistenceAfterService.delete(delete);
        return delete;
    }

}
